import Mock from 'mockjs2';
import { builder } from '../util';

// 获取企业信息
const basicInfo = () => {
  const mockData = Mock.mock({
    'iconPic': Mock.Random.image('64x64'),
    'logoPic': Mock.Random.image('208x64'),
    'loginPic': Mock.Random.image('504x408'),
    'name': '@ctitle(1, 20)'
  });
  
  return builder(mockData, '', 'ok');
};

// 获取登录方式
const loginTypes = () => {
  const mockData = ['account', 'hid', 'wechat'];
  
  return builder(mockData, '', 'ok');
};

// 获取企业信息
const info = () => {
  const mockData = Mock.mock({
    'avatar': Mock.Random.image('64x64'),
    'role': 'super_admin',
    'name': '@ctitle(1, 20)'
  });
  
  return builder(mockData, '', 'ok');
};

Mock.mock(/\/basic-info/, 'get', basicInfo);
Mock.mock(/\/login-types/, 'get', loginTypes);
Mock.mock(/\user\/get-by-token/, 'get', info);
